package com.winit.base.web;

import com.winit.common.base.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Api(value = "baseService", tags = {"baseService"}, description = "baseService")
@RestController
@RequestMapping("/api/v1/baseService")
public class BaseServiceController extends BaseController {
    private static Logger log = LoggerFactory.getLogger(BaseController.class);

    @Autowired
    protected HashOperations<String, String, Object> hashOperations;

    @RequestMapping(value = "/getSearchHistory", method = RequestMethod.GET)
    @ResponseStatus(HttpStatus.OK)
    @ApiOperation(value = "查询用户的搜索记录")
    @ResponseBody
    public Map getReqRemarks(@ApiParam(value = "userAccount，用户账户", required = true)@RequestParam(value = "userAccount", required = true)String userAccount){
        Object cache = this.hashOperations.entries(userAccount);
        return this.getRtn(BaseController.REQUEST_SUCCESS, BaseController.REQUEST_SUCCESS_MSG, cache);
    }

}
